#include"ros/ros.h"
#include"roborts_msgs/FricWhl.h"
#include"roborts_msgs/ShootCmd.h"
#include<cstdlib>

int main(int argc, char **argv)
{
    //ROS节点初始化
    ros::init(argc, argv, "firWhl_init_client");

    //创建节点句柄
    ros::NodeHandle n;

    //创建一个client,  请求cmd_fric_wheel service
    //service 消息类型是roborts_msgs::FricWhl
    ros::ServiceClient firwhl_client = n.serviceClient<roborts_msgs::FricWhl>("cmd_fric_wheel");
    ros::ServiceClient shoot_client = n.serviceClient<roborts_msgs::ShootCmd>("cmd_shoot");

     ROS_INFO("11111111111111111111111111111111");

    //创建roborts_msgs::FricWhl类型的service消息
    roborts_msgs::FricWhl frisrv;
    roborts_msgs::ShootCmd shootsrv;

    frisrv.request.open = true;
    shootsrv.request.mode = 1;
    shootsrv.request.number = 3;
     ROS_INFO("222222222222222222222222222222222");
    // client.call(frisrv);
    //发布service请求，等待摩擦轮的启动结果
    if(firwhl_client.call(frisrv))
    {
        ROS_INFO("Begin to boot friwhl!");
        usleep(1000);
        shoot_client.call(shootsrv);
        ROS_INFO("Begin to boot fire!");
    }
    else{
        ROS_ERROR("Failed to call service cmd_fric_wheel");
        return 1;
    }
    return 0;
}